import React, { useEffect } from 'react'
 
const useDebounce = (fn,delay) => {
  let timer=null
  return function(...args){
    if(timer){
       clearTimeout(timer)
    }
    timer=setTimeout(()=>{
        fn(...args)
    },delay)
  }
}

export default useDebounce